package org.hxyjs.dao.impl;

import org.hxyjs.dao.LikerecordDao;
import org.hxyjs.entity.Likerecord;
import org.hxyjs.mapper.LikerecordMapper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

@Repository("likerecordDao")//一般实现类不会直接生成默认对象名 而是使用 接口的默认对象名
public class LikerecordDaoImpl implements LikerecordDao {
    @Resource //autowired 会装配能够直接扫描到的对象  resource spring容器运行的时候才找到需要的对象  注入
    private LikerecordMapper likerecordMapper;
    public List<Likerecord>  getAllLikerecords() throws Exception{
        return likerecordMapper.selectByExample(null);
    }

    @Override
    public Integer deleteLikerecordByLrno(String lrno)  throws Exception{
        return likerecordMapper.deleteByPrimaryKey(lrno);
    }

    @Override
    public Integer updateLikerecordByLrno(Likerecord likerecord)  throws Exception{
        return likerecordMapper.updateByPrimaryKey(likerecord);
    }

    @Override
    public Integer addLikerecord(Likerecord likerecord)  throws Exception{
        return likerecordMapper.insertSelective(likerecord);
    }

}
